class LoginTest(object):
    """封装登陆类"""

    def __init__(self):
        pass

    def testsuccess(self, session, jsonData):
        """定义测试成功方法"""
        response = session.post(url="http://ihrm-test.itheima.net/api/sys/login",
                                headers={"Content-Type": "application/json"},
                                json=jsonData)
        return response


if __name__ == '__main__':
    import requests

    # 实例化session
    session = requests.Session()
    # 实例化类
    login1 = LoginTest()
    # 实例化类调用方法,并赋值给变量
    response = login1.testsuccess(session, {"mobile": "13800000002", "password": "123456"})
    # 按照json格式打印出接收的响应结果
    print(response.json())
